#include "def.h"

void WriteMap(Graph G) {
    ofstream out("map.txt");
    out << G.vertexNum << "\t" << G.arcNum << endl;

    for (int i = 0; i < G.vertexNum; i++) {
        out << G.vexs[i].name << "\t" << G.vexs[i].info << endl;
    }

    for (int i = 0; i < G.vertexNum; i++) {
        for (int j = 0; j < G.vertexNum; j++) {
            if (G.arcs[i][j] != INF) {
                out << G.vexs[i].name << "\t" << G.vexs[j].name << "\t" << G.arcs[i][j] << endl;
            }
        }
    }

    out.close();
    cout << "地图信息已成功写入文件！" << endl;
}